package com.boc.ewr.util.file.enumeration;

import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.Optional;

/**
 * 核实情况
 */
@Slf4j
public enum CheckStatusEnum {

    GUIDED("11", "已指导"),
    CUSCONTACTED("41", "已联系客户核实情况"),
    OTHER("53", "其他"),
    NOCONTACTED("52", "未联系"),
    CONTACTED("51", "已联系"),
    NOCUSCONTACTED("42", "未联系客户（处理结果需填明原因）"),
    INFOCHANGE("33", "客户信息发生改变"),
    UNCLOSEACC("32", "未销户"),
    CLOSEACC("31", "已销户"),
    NOGUIDED("12", "未指导（处理结果需填明原因）");

    private String index;
    private String value;

    CheckStatusEnum(String index, String value){

        this.index = index;
        this.value = value;
    }

    /**
     * 根据value获取枚举对象
     *
     * @param val
     * @return
     */
    public static CheckStatusEnum getIndexByValue(String val) {
        Optional<CheckStatusEnum> first = Arrays.stream(CheckStatusEnum.values()).filter(e -> e.getValue().equals(val)).findFirst();
        CheckStatusEnum expEnum = first.orElse(null);
        log.info("选择的枚举类型是：" + expEnum.toString());
        return expEnum;
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
